home *** CD-ROM | disk | FTP | other *** search
/ Building Homes of Our Own / Building Homes of our Own.iso / setup / data1.cab / Everything / working / houCons.dxr / interface_211_IntWallsClickTracker behave.ls < prev    next >
Encoding:
Text File  |  2002-09-25  |  2.0 KB  |  88 lines

  1. property mySprite, myRect, myLoc, lastRoll, myType, HLinesList, VLine, targetSprite
  2.  
  3. on beginSprite me
  4.   global gActorListMan
  5.   mySprite = me.spriteNum
  6.   myRect = rect(93, 546, 257, 592)
  7.   setUpRegions(me)
  8.   myType = #IntWallClickTracker
  9.   registerSprite(gActorListMan, mySprite)
  10. end
  11.  
  12. on endSprite me
  13.   global gActorListMan
  14.   unRegisterSprite(gActorListMan, mySprite)
  15. end
  16.  
  17. on stepFrame me
  18.   global gCursorMan, gClickSprite
  19.   if voidp(targetSprite) then
  20.     targetSprite = sendAllSprites(#sendSpriteNum, #FloorPlanDisplay)
  21.   end if
  22.   thisRoll = rollover()
  23.   if thisRoll = mySprite then
  24.     setCursor(gCursorMan, #handNormal, myType)
  25.     if (lastRoll <> mySprite) and not (the mouseDown) then
  26.       lastRoll = mySprite
  27.       exit
  28.     end if
  29.     if (gClickSprite = mySprite) and the mouseDown then
  30.       lastRoll = me.mySprite
  31.       setCursor(gCursorMan, #handNormal, myType)
  32.       exit
  33.     end if
  34.   else
  35.     if lastRoll = mySprite then
  36.       lastRoll = 0
  37.       setCursor(gCursorMan, #Arrow, myType)
  38.     end if
  39.   end if
  40. end
  41.  
  42. on mouseDown me
  43.   global gClickSprite
  44.   if resWindowUp() or modalWindowUp() then
  45.     exit
  46.   end if
  47.   gClickSprite = mySprite
  48.   if voidp(targetSprite) then
  49.     targetSprite = sendAllSprites(#sendSpriteNum, #FloorPlanDisplay)
  50.   end if
  51.   clickLoc = the clickLoc
  52.   ClickV = clickLoc[2]
  53.   if ClickV > VLine then
  54.     Row = 4
  55.   else
  56.     Row = 0
  57.   end if
  58.   ClickH = clickLoc[1]
  59.   if ClickH < HLinesList[1] then
  60.     column = 1
  61.   else
  62.     if ClickH < HLinesList[2] then
  63.       column = 2
  64.     else
  65.       if ClickH < HLinesList[3] then
  66.         column = 3
  67.       else
  68.         column = 4
  69.       end if
  70.     end if
  71.   end if
  72.   whichAction = column + Row
  73.   put whichAction
  74.   doButtonUpClick(myType, 1)
  75.   sendSprite(targetSprite, #setDisplay, whichAction)
  76. end
  77.  
  78. on setUpRegions me
  79.   myHeight = myRect[4] - myRect[2]
  80.   VLine = myRect[2] + (myHeight / 2)
  81.   HLinesList = []
  82.   myWidth = myRect[3] - myRect[1]
  83.   inc = myWidth / 4
  84.   append(HLinesList, myRect[1] + inc)
  85.   append(HLinesList, myRect[1] + (inc * 2))
  86.   append(HLinesList, myRect[1] + (inc * 3))
  87. end
  88.